package model

import "time"
import "gorm.io/gorm"

type BaseModel struct {
	ID        int32     `gorm:"primary_key;AUTO_INCREMENT"`
	CreatedAt time.Time `gorm:"column:created_time"`
	UpdatedAt time.Time `gorm:"column:updated_time"`
	DeletedAt gorm.DeletedAt
	IsDeleted bool
}

type User struct {
	BaseModel
	NickName string     `gorm:"column:nick_name;type:varchar(20)"`
	Password string     `gorm:"column:password;type:varchar(100);not null"`
	Phone    string     `gorm:"index:idx_phone;unique;type:varchar(11);not null"`
	Birthday *time.Time `gorm:"type:datetime"`
	Gender   string     `gorm:"column:gender;type:varchar(6);default:'male'"`
	Role     int        `gorm:"column:role;type:int comment '1为普通用户，2为管理员';default:1"`
}
